﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _20170124_Practice_continued_Classes
{
    class Human
    {
        private string firstName;
        private string lastName;
        private DateTime birthday = new DateTime();

        public string FirstName
        {
            get
            {
                return firstName;
            }
            set
            {
                if (!String.IsNullOrWhiteSpace(value))
                {
                    firstName = value;
                }
                else
                {
                    Console.WriteLine("Type in a name!");
                }
            }
        }

        public string LastName
        {
            get
            {
                return lastName;
            }
            set
            {
                if (!String.IsNullOrWhiteSpace(value))
                {
                    lastName = value;
                }
                else
                {
                    Console.WriteLine("Type in a surname!");
                }
            }
        }

        public DateTime Birthday
        {
            get
            {
                return birthday;
            }
            set
            {
                if ((DateTime) value <= DateTime.Now)
                {
                    birthday = value;
                }
                else
                {
                    Console.WriteLine("Can't implement people from the future!");
                }
            }
        }

        public Human(string firstName, string lastName, DateTime birthday)
        {
            this.firstName = firstName;
            this.lastName = lastName;
            this.birthday = birthday;
        }

        public void PrintHumanInfo()
        {
            //TimeSpan age = new TimeSpan();
            //age = (DateTime.Today - Birthday);
            Console.WriteLine("{0} {1}, born on {2}", FirstName, LastName, Birthday);
        }
    }
}
